package com.sxfq.loansupermarket.backsystem.modular.logsf.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.sxfq.loansupermarket.backsystem.core.util.StringUtil;
import com.sxfq.loansupermarket.backsystem.modular.logsf.dao.ReservationsLogDao;
import com.sxfq.loansupermarket.backsystem.modular.logsf.entity.*;
import com.sxfq.loansupermarket.backsystem.modular.logsf.service.IReservationsLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
@Transactional
public class ReservationsLogServiceImpl implements IReservationsLogService {

    @Autowired
    private ReservationsLogDao dao;

    @Override
    public List<ReservationsDeleteLogInfo> getDeleteList(Page<ReservationsDeleteLogInfo> page, SearchReservationsDeleteLogInfo searchInfo) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("page", page);
        if (StringUtil.isNotEmpty(searchInfo.getDeleteCphone())) {
            params.put("deleteCphone", searchInfo.getDeleteCphone());
        }
        if (StringUtil.isNotEmpty(searchInfo.getArchiving())) {
            params.put("archiving", searchInfo.getArchiving());
        }
        if (StringUtil.isNotEmpty(searchInfo.getStartTime())) {
            params.put("startTime", searchInfo.getStartTime());
        }
        if (StringUtil.isNotEmpty(searchInfo.getEndTime())) {
            params.put("endTime", searchInfo.getEndTime());
        }
        params.put("startIndex", searchInfo.getStartIndex());
        params.put("limitIndex", searchInfo.getLimitIndex());
        return dao.getDeleteList(page, params);
    }

    @Override
    public List<TreatmentUnitlLogInfo> getDeleteListks(Page<TreatmentUnitlLogInfo> page, SearchTreatmentUnitlLogInfo searchInfo) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("page", page);
        if (StringUtil.isNotEmpty(searchInfo.getStartTime())) {
            params.put("startTime", searchInfo.getStartTime());
        }
        if (StringUtil.isNotEmpty(searchInfo.getEndTime())) {
            params.put("endTime", searchInfo.getEndTime());
        }
        if (StringUtil.isNotEmpty(searchInfo.getOutpatientName())) {
            params.put("outpatientName", searchInfo.getOutpatientName());
        }
        if (StringUtil.isNotEmpty(searchInfo.getStatus())) {
            params.put("status", searchInfo.getStatus());
        }
        if (StringUtil.isNotEmpty(searchInfo.getSreach())) {
            params.put("sreach", searchInfo.getSreach());
        }
        params.put("startIndex", searchInfo.getStartIndex());
        params.put("limitIndex", searchInfo.getLimitIndex());
        return dao.getDeleteListks(page, params);
    }

    @Override
    public List<ReservationsUpdateLogInfo> getUpdateList(Page<ReservationsUpdateLogInfo> page, SearchReservationsUpdateLogInfo searchInfo) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("page", page);
        if (StringUtil.isNotEmpty(searchInfo.getArchiving())) {
            params.put("archiving", searchInfo.getArchiving());
        }
        if (StringUtil.isNotEmpty(searchInfo.getStartTime())) {
            params.put("startTime", searchInfo.getStartTime());
        }
        if (StringUtil.isNotEmpty(searchInfo.getEndTime())) {
            params.put("endTime", searchInfo.getEndTime());
        }
        params.put("startIndex", searchInfo.getStartIndex());
        params.put("limitIndex", searchInfo.getLimitIndex());
        return dao.getUpdateList(page, params);
    }

    @Override
    public List<ReservationsUpdateLogInfo> getUpdatefollowerList(Page<ReservationsUpdateLogInfo> page, SearchReservationsUpdateLogInfo searchInfo) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("page", page);
        if (StringUtil.isNotEmpty(searchInfo.getArchiving())) {
            params.put("archiving", searchInfo.getArchiving());
        }
        if (StringUtil.isNotEmpty(searchInfo.getUpdateCphone())) {
            params.put("updateCphone", searchInfo.getUpdateCphone());
        }
        if (StringUtil.isNotEmpty(searchInfo.getStartTime())) {
            params.put("startTime", searchInfo.getStartTime());
        }
        if (StringUtil.isNotEmpty(searchInfo.getEndTime())) {
            params.put("endTime", searchInfo.getEndTime());
        }
        params.put("startIndex", searchInfo.getStartIndex());
        params.put("limitIndex", searchInfo.getLimitIndex());
        return dao.getUpdatefollowerList(page, params);
    }

    @Override
    public List<ReservationsCanceLogInfo> getCanceList(Page<ReservationsCanceLogInfo> page, SearchReservationsCanceLogInfo searchInfo) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("page", page);
        if (StringUtil.isNotEmpty(searchInfo.getArchiving())) {
            params.put("archiving", searchInfo.getArchiving());
        }
        if (StringUtil.isNotEmpty(searchInfo.getStartTime())) {
            params.put("startTime", searchInfo.getStartTime());
        }
        if (StringUtil.isNotEmpty(searchInfo.getEndTime())) {
            params.put("endTime", searchInfo.getEndTime());
        }
        params.put("startIndex", searchInfo.getStartIndex());
        params.put("limitIndex", searchInfo.getLimitIndex());
        return dao.getCanceList(page, params);
    }

    @Override
    public int getQueryPagesCount(Page<ReservationsDeleteLogInfo> page, SearchReservationsDeleteLogInfo searchInfo) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("page", page);
        if (StringUtil.isNotEmpty(searchInfo.getDeleteCphone())) {
            params.put("deleteCphone", searchInfo.getDeleteCphone());
        }
        if (StringUtil.isNotEmpty(searchInfo.getArchiving())) {
            params.put("archiving", searchInfo.getArchiving());
        }
        if (StringUtil.isNotEmpty(searchInfo.getStartTime())) {
            params.put("startTime", searchInfo.getStartTime());
        }
        if (StringUtil.isNotEmpty(searchInfo.getEndTime())) {
            params.put("endTime", searchInfo.getEndTime());
        }
        return dao.getQueryPagesCount(page, params);
    }

    @Override
    public int getQueryPagesCountks(Page<TreatmentUnitlLogInfo> page, SearchTreatmentUnitlLogInfo searchInfo) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("page", page);
        if (StringUtil.isNotEmpty(searchInfo.getStartTime())) {
            params.put("startTime", searchInfo.getStartTime());
        }
        if (StringUtil.isNotEmpty(searchInfo.getEndTime())) {
            params.put("endTime", searchInfo.getEndTime());
        }
        if (StringUtil.isNotEmpty(searchInfo.getOutpatientName())) {
            params.put("outpatient_name", searchInfo.getOutpatientName());
        }
        if (StringUtil.isNotEmpty(searchInfo.getStatus())) {
            params.put("status", searchInfo.getStatus());
        }
        if (StringUtil.isNotEmpty(searchInfo.getSreach())) {
            params.put("sreach", searchInfo.getSreach());
        }
        return dao.getQueryPagesCountks(page, params);
    }

    @Override
    public int getQueryPagesCountt(Page<ReservationsUpdateLogInfo> page, SearchReservationsUpdateLogInfo searchInfo) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("page", page);
        if (StringUtil.isNotEmpty(searchInfo.getArchiving())) {
            params.put("archiving", searchInfo.getArchiving());
        }
        if (StringUtil.isNotEmpty(searchInfo.getStartTime())) {
            params.put("startTime", searchInfo.getStartTime());
        }
        if (StringUtil.isNotEmpty(searchInfo.getEndTime())) {
            params.put("endTime", searchInfo.getEndTime());
        }
        return dao.getQueryPagesCountt(page, params);
    }

    @Override
    public int getQueryPagesfollowerCountt(Page<ReservationsUpdateLogInfo> page, SearchReservationsUpdateLogInfo searchInfo) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("page", page);
        if (StringUtil.isNotEmpty(searchInfo.getArchiving())) {
            params.put("archiving", searchInfo.getArchiving());
        }
        if (StringUtil.isNotEmpty(searchInfo.getUpdateCphone())) {
            params.put("updateCphone", searchInfo.getUpdateCphone());
        }
        if (StringUtil.isNotEmpty(searchInfo.getStartTime())) {
            params.put("startTime", searchInfo.getStartTime());
        }
        if (StringUtil.isNotEmpty(searchInfo.getEndTime())) {
            params.put("endTime", searchInfo.getEndTime());
        }
        return dao.getQueryPagesfollowerCountt(page, params);
    }

    @Override
    public int getQueryPagesCounts(Page<ReservationsCanceLogInfo> page, SearchReservationsCanceLogInfo searchInfo) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("page", page);
        if (StringUtil.isNotEmpty(searchInfo.getArchiving())) {
            params.put("archiving", searchInfo.getArchiving());
        }
        if (StringUtil.isNotEmpty(searchInfo.getStartTime())) {
            params.put("startTime", searchInfo.getStartTime());
        }
        if (StringUtil.isNotEmpty(searchInfo.getEndTime())) {
            params.put("endTime", searchInfo.getEndTime());
        }
        return dao.getQueryPagesCounts(page, params);
    }

}

